﻿<?php
//客户管理类
class CollegeAction extends CommonAction {
	
	public function article() {
		parent::userauth2(110);
		$data['start'] = empty($_GET['page'])?1:($_GET['page']);
		$data['pageSize'] = 8;
		$data['status'] = !isset($_GET['s'])?null:$_GET['s'];
		$data['site'] = !isset($_GET['site'])?null:$_GET['site'];

		//$data['courseName'] = '';
		$html = send_post(C('SMART_URL').'/smart/article/manager/queryArticleList',$data);
		$count = $html['data']['sumRow'];
		$list = $html['data']['artcileList'];
//		dump($list);
		import('ORG.Util.Page');				// 导入分页类
		$pagenum = isset ( $_REQUEST ['page'] ) ? $_REQUEST ['page'] : 1;
		$page_row = $data['pageSize'];//每页显示条数
		$p = new Page ($count,$page_row,8);
		$p->isJumpPage = true;
		$p->setConfig('theme','%totalRow% %header% %nowPage%/%totalPage% 页%first% %upPage% %linkPage% %downPage% %end% %jump%');
		$show = $p->show();
		$this->assign('list',$list);
		$this->assign('key',$keyWord);
		$this->assign('page',$show);
		$this->assign('newsurl',C('NEWSURL'));
		$this->assign('url',C('URL'));
		$this->assign('admin',$_SESSION['ThinkUser']);
		
		$this->assign('status', D('status')->field('id, name, value')->order('id asc')->where('pid = 2')->select());
		$this->assign('site', D('status')->field('id, name, value')->order('id asc')->where('pid = 6')->select());

		$this->display();
	}

	public function articleDetail(){
		$data['arcId']= $_GET['sid'];
		$html = send_post(C('SMART_URL').'/smart/article/manger/queryArticleDetail',$data);
		
		$this->assign('article',$html['data']['article']);
		$this->assign('user',$html['data']['smartUser']);
		$this->assign('SMART_URL',C('SMART_URL'));

		$this->display();
	}

	public function userinfo(){
		$data['userId']= $_GET['sid'];

		$html = send_post(C('SMART_URL').'/smart/user/manager/userDetail',$data);

		$this->assign('user',$html['data']['userInfo']);

		$this->assign('SMART_URL',C('SMART_URL'));
		$this->assign('WEBIMG',C('WEBIMG'));
		$this->display();
	}


	public function getsearchparam()
	{
		//获取用户状态
		$this->assign('status', D('status')->field('id, name, value')->order('id asc')->where('pid = 2')->select());
	}



	//用户管理
	public function userlist() {
		parent::userauth2(110);
		$this->getsearchparam();

		$data['start'] = empty($_GET['page'])?1:($_GET['page']);
		$data['pageSize'] = 8;
		$data['status'] = empty($_GET['s'])?' ':$_GET['s'];
		$data['userRole'] = empty($_GET['r'])?' ':$_GET['r'];
		$data['telephone'] = empty($_GET['telephone'])?' ':$_GET['telephone'];

		$html = send_post(C('SMART_URL').'/smart/user/manager/queryUserList',$data);

		$count = $html['data']['userPageInfo']['totalRowNumber'];
		$list = $html['data']['userPageInfo']['dataList'];
//		dump($list);
		import('ORG.Util.Page');				// 导入分页类
		$pagenum = isset ( $_REQUEST ['page'] ) ? $_REQUEST ['page'] : 1;
		$page_row = $data['pageSize'];//每页显示条数
		$p = new Page ($count,$page_row,8);
		$p->isJumpPage = true;
		$p->setConfig('theme','%totalRow% %header% %nowPage%/%totalPage% 页%first% %upPage% %linkPage% %downPage% %end% %jump%');
		$show = $p->show();
		$this->assign('list',$list);

		$this->assign('key',$data['telephone']);

		$this->assign('page',$show);
		$this->assign('SMART_URL',C('SMART_URL'));
		$this->assign('admin',$_SESSION['ThinkUser']);
		$this->display();
	}





	//用户管理
	public function teacher() {
		parent::userauth2(110);
		$this->getsearchparam();

		$data['start'] = empty($_GET['page'])?1:($_GET['page']);
		$data['pageSize'] = 8;
	/*	$data['status'] = empty($_GET['s'])?' ':$_GET['s'];
		$data['userRole'] = empty($_GET['r'])?' ':$_GET['r'];
		*/
        $data['teacherName'] = empty($_GET['teacherName'])?' ':$_GET['teacherName'];
		$html = send_post(C('SMART_URL').'/smart/teacher/manager/queryTeacherList',$data);

		$count = $html['data']['sumRow'];
		$list = $html['data']['teacherList'];
//		dump($list);
		import('ORG.Util.Page');				// 导入分页类
		$pagenum = isset ( $_REQUEST ['page'] ) ? $_REQUEST ['page'] : 1;
		$page_row = $data['pageSize'];//每页显示条数
		$p = new Page ($count,$page_row,8);
		$p->isJumpPage = true;
		$p->setConfig('theme','%totalRow% %header% %nowPage%/%totalPage% 页%first% %upPage% %linkPage% %downPage% %end% %jump%');
		$show = $p->show();
		$this->assign('list',$list);

	/*	$this->assign('key',$data['telephone']);*/

		$this->assign('page',$show);
		$this->assign('SMART_URL',C('SMART_URL'));
		$this->assign('admin',$_SESSION['ThinkUser']);
		$this->display();
	}


public function feedback() {
		parent::userauth2(110);
		$data['start'] = empty($_GET['page'])?1:($_GET['page']);
		$data['pageSize'] = 8;
		$data['feedType'] = !isset($_GET['s'])?' ':$_GET['s'];
		//$data['courseName'] = '';
		$html = send_post(C('SMART_URL').'/smart/feedback/manage/queryList',$data);
		$count = $html['data']['feedBackPageInfo']['totalRowNumber'];
		$list = $html['data']['feedBackPageInfo']['dataList'];
//		dump($list);
		import('ORG.Util.Page');				// 导入分页类
		$pagenum = isset ( $_REQUEST ['page'] ) ? $_REQUEST ['page'] : 1;
		$page_row = $data['pageSize'];//每页显示条数
		$p = new Page ($count,$page_row,8);
		$p->isJumpPage = true;
		$p->setConfig('theme','%totalRow% %header% %nowPage%/%totalPage% 页%first% %upPage% %linkPage% %downPage% %end% %jump%');
		$show = $p->show();
		$this->assign('list',$list);
		$this->assign('key',$keyWord);
		$this->assign('status', D('status')->field('id, name, value')->order('id asc')->where('pid = 4')->select());
		$this->assign('page',$show);
		$this->assign('SMART_URL',C('SMART_URL'));
		$this->assign('url',C('URL'));
		$this->assign('admin',$_SESSION['ThinkUser']);
		
		/*$this->assign('status', D('status')->field('id, name, value')->order('id asc')->where('pid = 2')->select());*/

		$this->display();
	}

	public function feedbackdetail(){
		$data['sid']= $_GET['sid'];
		$html = send_post(C('SMART_URL').'/smart/feedback/manage/queryDetail',$data);
		
		$this->assign('feedBack',$html['data']['feedBack']);
		//$this->assign('user',$html['data']['boutique']);
		$this->assign('SMART_URL',C('SMART_URL'));

		$this->display();
	}


public function leaveMsg() {
		parent::userauth2(110);
		$data['start'] = empty($_GET['page'])?1:($_GET['page']);
		$data['pageSize'] = 8;
		$data['feedType'] = !isset($_GET['s'])?1:$_GET['s'];
		//$data['courseName'] = '';
		$html = send_post(C('SMART_URL').'/smart/feedback/manage/queryList',$data);
		$count = $html['data']['feedBackPageInfo']['totalRowNumber'];
		$list = $html['data']['feedBackPageInfo']['dataList'];
//		dump($list);
		import('ORG.Util.Page');				// 导入分页类
		$pagenum = isset ( $_REQUEST ['page'] ) ? $_REQUEST ['page'] : 1;
		$page_row = $data['pageSize'];//每页显示条数
		$p = new Page ($count,$page_row,8);
		$p->isJumpPage = true;
		$p->setConfig('theme','%totalRow% %header% %nowPage%/%totalPage% 页%first% %upPage% %linkPage% %downPage% %end% %jump%');
		$show = $p->show();
		$this->assign('list',$list);
		$this->assign('key',$keyWord);
		$this->assign('status', D('status')->field('id, name, value')->order('id asc')->where('pid = 5')->select());
		$this->assign('page',$show);
		$this->assign('SMART_URL',C('SMART_URL'));
		$this->assign('url',C('URL'));
		$this->assign('admin',$_SESSION['ThinkUser']);
		
		/*$this->assign('status', D('status')->field('id, name, value')->order('id asc')->where('pid = 2')->select());*/

		$this->display();
	}

	public function leaveMsgDetail(){
		$data['sid']= $_GET['sid'];
		$html = send_post(C('SMART_URL').'/smart/feedback/manage/queryDetail',$data);
		
		$this->assign('feedBack',$html['data']['feedBack']);
		//$this->assign('user',$html['data']['boutique']);
		$this->assign('SMART_URL',C('SMART_URL'));

		$this->display();
	}


public function systemInfo() {
		parent::userauth2(110);
		$data['start'] = empty($_GET['page'])?1:($_GET['page']);
		$data['pageSize'] = 8;
		$data['status'] = !isset($_GET['s'])?' ':$_GET['s'];
		//$data['courseName'] = '';
		$html = send_post(C('SMART_URL').'/smart/sysInfo/manage/queryList',$data);
		$count = $html['data']['systemPageInfo']['totalRowNumber'];
		$list = $html['data']['systemPageInfo']['dataList'];
//		dump($list);
		import('ORG.Util.Page');				// 导入分页类
		$pagenum = isset ( $_REQUEST ['page'] ) ? $_REQUEST ['page'] : 1;
		$page_row = $data['pageSize'];//每页显示条数
		$p = new Page ($count,$page_row,8);
		$p->isJumpPage = true;
		$p->setConfig('theme','%totalRow% %header% %nowPage%/%totalPage% 页%first% %upPage% %linkPage% %downPage% %end% %jump%');
		$show = $p->show();
		$this->assign('list',$list);
		$this->assign('key',$keyWord);
		$this->assign('page',$show);
		$this->assign('SMART_URL',C('SMART_URL'));
		$this->assign('url',C('URL'));
		$this->assign('admin',$_SESSION['ThinkUser']);
		
		/*$this->assign('status', D('status')->field('id, name, value')->order('id asc')->where('pid = 2')->select());*/

		$this->display();
	}

	public function systemInfoDetail(){
		$data['sid']= $_GET['sid'];
		$html = send_post(C('SMART_URL').'/smart/sysInfo/manage/queryDetail',$data);
		$this->assign('smartInfo',$html['data']['smartInfo']);
		//$this->assign('user',$html['data']['boutique']);
		$this->assign('SMART_URL',C('SMART_URL'));

		$this->display();
	}

	//更新文章
	public function systemInfoEdit() {
          $data['sid']= $_GET['sid'];
		$html = send_post(C('SMART_URL').'/smart/sysInfo/manage/queryDetail',$data);
		$this->assign('smartInfo',$html['data']['smartInfo']);
		//$this->assign('user',$html['data']['boutique']);
		$this->assign('SMART_URL',C('SMART_URL'));

		$this->display();
	}


	//更新文章
	public function editArticle() {
          $data['sid']= $_GET['sid'];
		$html = send_post(C('SMART_URL').'/smart/article/manager/detail',$data);
        //  $html = send_post('http://localhost:8001/smart/article/manager/detail',$data);
		$this->assign('article',$html['data']);
		//$this->assign('user',$html['data']['boutique']);
		$this->assign('SMART_URL',C('SMART_URL'));

		$this->display();
	}

//添加内容
	public function addSystemInfo() {
        $this->assign('SMART_URL',C('SMART_URL'));
		$this->display();
	}
	
	
	
//添加内容
	public function addArticle() {
		$data['parentCode']= $_GET['parentCode'];
		$html = send_post(C('SMART_URL').'/smart/home/queyNav',$data);
		$this->assign('category',$html['data']['navList']);
        $this->assign('SMART_URL',C('SMART_URL'));
		$this->display();
	}

	//时间美化函数
	protected function Beautifytime($dtime) {
		$dtime = strtotime($dtime);
		$betime = time()-$dtime;
		$timename='';
		switch($betime) {
			case ($betime < 60):
			$timename = floor($betime).'秒前';
			break;
			case ($betime < 3600 && $betime > 60):
			$timename = floor(($betime/60)).'分钟前';
			break;
			case ($betime < 86400 && $betime > 3600):
			$timename = floor(($betime/60/60)).'小时前';
			break;
			case ($betime < 2592000 && $betime > 86400):
			$timename = floor(($betime/60/60/30)).'天前';
			break;
			case ($betime < 31536000 && $betime > 2592000):
			$timename = floor(($betime/60/60/30/12)).'个月前';
			break;
			case ($betime < 3153600000 && $betime > 31536000):
			$timename = floor(($betime/60/60/30/12/100)).'年前';
			break;
		}
		return $timename;
	}

}
?>

